package com.xiaoq.users.entity;

import java.io.Serializable;
import java.util.List;

import org.mongodb.morphia.annotations.Embedded;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Indexed;
import org.mongodb.morphia.utils.IndexDirection;

import com.xiaoq.MongoEntity;

@Entity(value="user", noClassnameStored=true)
public class UserEntity extends MongoEntity implements Serializable {
    public static enum Role {
    	ANONYMOUS(0), //匿名用户
        USER(10),  //普通用户
        STOREKEEPER(20), //店主
        INTERPRETER(30), //讲解员
        ADMIN(40); //管理员
        public int value;
        
        Role(int value) {
        	this.value = value;
        }
        
        public int value() {
        	return this.value;
        }
    }
    public static enum RegMethod {
    	ANONYMOUS(0),
        MOBILE(1),
        EMAIL(2),
        WEIXIN(3),
        WEIBO(4);
        public int value;
        
        RegMethod(int value) {
        	this.value = value;
        }
        
        public int value() {
        	return this.value;
        }
    }
    public static enum ThirdAccountType {
        WEIXIN(1),
        WEIBO(2);
        public int value;
        ThirdAccountType(int value) {
        	this.value = value;
        }
        
        public int value() {
        	return this.value;
        }
    }
	private String name;
	private String nickName;
	private String logoUrl;
	private String account;
	private String passwd;
	private String salt;
	
	@Indexed(value=IndexDirection.ASC) 
	private String mobile;  //db.user.ensureIndex({"mobile":1}) 创建索引
	private String email;
	private boolean mobileValid;
	private boolean emailValid;
	private List<ThirdAccountInfoEntity> thirdAccountList;
	private String type;
	private List<Role> userRoleList;
	private Long lastLoginTime;
	private Integer gender;
	private String city;
	private String idNo;
	private RegMethod regMethod;
	private boolean anonymous;
	private Long birthday;
	private Integer userGrade;
	
	private Integer clientType;
	
	@Embedded
	private UserTermDeviceEntity termDevice;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getLogoUrl() {
		return logoUrl;
	}

	public void setLogoUrl(String logoUrl) {
		this.logoUrl = logoUrl;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getPasswd() {
		return passwd;
	}

	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public boolean isMobileValid() {
		return mobileValid;
	}

	public void setMobileValid(boolean mobileValid) {
		this.mobileValid = mobileValid;
	}

	public boolean isEmailValid() {
		return emailValid;
	}

	public void setEmailValid(boolean emailValid) {
		this.emailValid = emailValid;
	}

	public List<ThirdAccountInfoEntity> getThirdAccountList() {
		return thirdAccountList;
	}

	public void setThirdAccountList(List<ThirdAccountInfoEntity> thirdAccountList) {
		this.thirdAccountList = thirdAccountList;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public List<Role> getUserRoleList() {
		return userRoleList;
	}

	public void setUserRoleList(List<Role> userRoleList) {
		this.userRoleList = userRoleList;
	}

	public Long getLastLoginTime() {
		return lastLoginTime;
	}

	public void setLastLoginTime(Long lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	public Integer getGender() {
		return gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getIdNo() {
		return idNo;
	}

	public void setIdNo(String idNo) {
		this.idNo = idNo;
	}

	public RegMethod getRegMethod() {
		return regMethod;
	}

	public void setRegMethod(RegMethod regMethod) {
		this.regMethod = regMethod;
	}

	public boolean isAnonymous() {
		return anonymous;
	}

	public void setAnonymous(boolean anonymous) {
		this.anonymous = anonymous;
	}

	public Long getBirthday() {
		return birthday;
	}

	public void setBirthday(Long birthday) {
		this.birthday = birthday;
	}

	public Integer getUserGrade() {
		return userGrade;
	}

	public void setUserGrade(Integer userGrade) {
		this.userGrade = userGrade;
	}

	public Integer getClientType() {
		return clientType;
	}

	public void setClientType(Integer clientType) {
		this.clientType = clientType;
	}

	public UserTermDeviceEntity getTermDevice() {
		return termDevice;
	}

	public void setTermDevice(UserTermDeviceEntity termDevice) {
		this.termDevice = termDevice;
	}
	

	
}
